#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <WinSock2.h>
#include "Types.h"
#include "GeneralFunctions.h"
#include <conio.h>
#include "Hw4RandomNumbers.h"
#include "ServerClientTools.h"
#include "SocketSendRecvTools.h"

#include "ClockModule.h"
#include "SimulatorModule.h"
#include "ManagerModule.h"
#include "BatteryModule.h"
#include "InterceptorModule.h"


#define DEBUG_MODE

int main(int argc, char *argv[])
{
	TMode Mode;

	SetWindowTextA(GetConsoleWindow(), argv[1]);
	printf("%s Mode\n", argv[1]);
	printf("===============\n");
	printf("IP: %s, Port: %d\n\n", argv[2], atoi(argv[3]));

	Mode = ConvertModeNameToTMode(argv[1]);
	VerifyNumOfArgs(Mode, argc);
				

	switch (Mode)
		{
		case MODE_CLOCK:
			MainClock(argc, argv);
			break;
		case MODE_BATTERY:
			MainBattery(argc, argv);
			break;
		case MODE_INTERCEPTOR:
			MainInterceptor(argc, argv);
			break;
		case MODE_MANAGER:
			MainManager(argc, argv);
			break;
		case MODE_SIMULATOR:
			MainSimulator(argc, argv);
			break;
		default:
			printf("No mode defined\n");
		}

	//getchar();
}